import { App, Provide, Inject } from '@midwayjs/decorator';
import { Application, Context } from '@midwayjs/koa';

@Provide()
export default abstract class Core {
  @App()
  protected app: Application;

  @Inject()
  protected ctx: Context;

  /**
   * 成功提示
   * @param {number} code
   * @param {string} message
   * @param {object} data
   * @returns
   */
  protected success(code: number, message: string, data?: any) {
    return { code: code || 200, message, data, success: true };
  }
}
